<?php
class Pesanan extends CI_Model {
	function __construct() {
		parent::__construct();
	}
	
	function get($where = NULL){
		if($where != NULL){
			$this->db->where($where);
		}
		$this->db->from('pesanan');
		return $this->db->get();
	}
	
	function add($data){
		$this->db->insert('pesanan',$data);
		return $this->db->insert_id();
	}
	
	function delete($id){
		$this->db->where('id_pesanan',$id);
		return $this->db->delete('pesanan');
	}
	
	//menu item	
	function add_item($data){
		$this->db->insert('pesanan_item',$data);
		return $this->db->insert_id();
	}
	
}